<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<link type="text/css" rel="stylesheet" href="css/style.css" />
    <!--[if IE 6]>
    <script src="js/iepng.js" type="text/javascript"></script>
        <script type="text/javascript">
           EvPNG.fix('div, ul, img, li, input, a'); 
        </script>
    <![endif]-->    
    <script type="text/javascript" src="js/jquery-1.11.1.min_044d0927.js"></script>
	<script type="text/javascript" src="js/jquery.bxslider_e88acd1b.js"></script>
    
    <script type="text/javascript" src="js/jquery-1.8.2.min.js"></script>
    <script type="text/javascript" src="js/menu.js"></script>    
        
	<script type="text/javascript" src="js/select.js"></script>
    
	<script type="text/javascript" src="js/lrscroll.js"></script>
    
    <script type="text/javascript" src="js/iban.js"></script>
    <script type="text/javascript" src="js/fban.js"></script>
    <script type="text/javascript" src="js/f_ban.js"></script>
    <script type="text/javascript" src="js/mban.js"></script>
    <script type="text/javascript" src="js/bban.js"></script>
    <script type="text/javascript" src="js/hban.js"></script>
    <script type="text/javascript" src="js/tban.js"></script>
    
	<script type="text/javascript" src="js/lrscroll_1.js"></script>
    
    
<title>尤洪</title>
</head>
<body>  
<!--Begin Header Begin-->
<div class="soubg">
	<div class="sou">
        <span class="fr">
        	<span class="fl">你好，请<a href="Login.html">登录</a>&nbsp; <a href="Regist.html" style="color:#ff4e00;">免费注册</a>&nbsp; </span>
            <span class="fl">|&nbsp;关注我们：</span>
            <span class="s_sh"><a href="#" class="sh1">新浪</a><a href="#" class="sh2">微信</a></span>
            <span class="fr">|&nbsp;<a href="#">手机版&nbsp;<img src="images/s_tel.png" align="absmiddle" /></a></span>
        </span>
    </div>
</div>
<!--End Header End--> 
<!--Begin Login Begin-->
<div class="log_bg">	
    <div class="top">
        <div class="logo"><a href="Index.html"><img src="images/logo.png" /></a></div>
    </div>
	<div class="regist">
    	<div class="log_img"><img src="images/l_img.png" width="611" height="425" /></div>
		<div class="reg_c">
        	<form id="userInfo">
            <table border="0" style="width:420px; font-size:14px; margin-top:20px;" cellspacing="0" cellpadding="0">
              <tr height="50" valign="top">
              	<td width="95">&nbsp;</td>
                <td>
                	<span class="fl" style="font-size:24px;">注册</span>
                    <span class="fr">已有商城账号，<a href="Login.html" style="color:#ff4e00;">我要登录</a></span>
                </td>
              </tr>
              <tr height="50">
                <td align="right"><font color="#ff4e00">*</font>&nbsp;用户名 &nbsp;</td>
                <td><input type="text" value="" class="l_user" name="userName" id="userName" onblur="checkUser()"/></td>
              </tr>
                <tr>
                    <td></td>
                    <td ><span id="userNameError" style="font-size: small; color: red"></span></td>
                </tr>
              <tr height="50">
                <td align="right"><font color="#ff4e00">*</font>&nbsp;密码 &nbsp;</td>
                <td><input type="password" value="" class="l_pwd" name="password" id="password" onblur="checkPwd()"/></td>

              </tr>
                <tr>
                    <td></td>
                    <td ><span id="passwordError" style="font-size: small; color: red"></span></td>
                </tr>
              <tr height="50">
                <td align="right"><font color="#ff4e00">*</font>&nbsp;确认密码 &nbsp;</td>
                <td><input type="password" value="" class="l_pwd" name="ps" id="reps" onblur="checkRepwd()"/></td>

              </tr>
                <tr>
                    <td></td>
                    <td ><span id="repsError" style="font-size: small; color: red"></span></td>
                </tr>
              <tr height="50">
                <td align="right"><font color="#ff4e00">*</font>&nbsp;邮箱 &nbsp;</td>
                <td><input type="text" value="" class="l_email" name="email" id="email" onblur="checkEmail()"/></td>

              </tr>
                <tr>
                    <td></td>
                    <td ><span id="emailError" style="font-size: small; color: red"></span></td>
                </tr>
              <tr height="50">
                <td align="right"><font color="#ff4e00">*</font>&nbsp;手机 &nbsp;</td>
                <td><input type="text" value="" class="l_tel" name="phone" id="phone" onblur="checkMobile()"/></td>

              </tr>
                <tr>
                    <td></td>
                    <td ><span id="phoneError" style="font-size: small; color: red"></span></td>
                </tr>
              <tr>
              	<td>&nbsp;</td>
                <td style="font-size:12px; padding-top:20px;">
                	<span style="font-family:'宋体';" class="fl">
                    	<label class="r_rad"><input type="checkbox" /></label><label class="r_txt">我已阅读并接受《用户协议》</label>
                    </span>
                </td>
              </tr>
              <tr height="60">
              	<td>&nbsp;</td>
                <td><input type="button" value="立即注册" class="log_btn " onclick="userRegist()" /></td>
              </tr>
            </table>
            </form>
        </div>
    </div>
</div>
<!--End Login End--> 
<!--Begin Footer Begin-->
<div class="btmbg">
    <div class="btm">
        备案/许可证编号：蜀ICP备12009302号-1-www.dingguagua.com   Copyright © 2015-2018 尤洪商城网 All Rights Reserved. 复制必究 , Technical Support: Dgg Group <br />
        <img src="images/b_1.gif" width="98" height="33" /><img src="images/b_2.gif" width="98" height="33" /><img src="images/b_3.gif" width="98" height="33" /><img src="images/b_4.gif" width="98" height="33" /><img src="images/b_5.gif" width="98" height="33" /><img src="images/b_6.gif" width="98" height="33" />
    </div>    	
</div>
<!--End Footer End -->


<script type="text/javascript">
    function divId(elementId){/*做一个取元素的函数  下面函数代码就不用写那么长*/
        return document.getElementById(elementId);
    }

    /*验证用户名*/
    function checkUser(){
        var user=$("#userName").val();//取到值
        console.log(user)
        var userId=divId("userNameError");//取到响应元素
        userId.innerHTML="";//先让他赋值为空
        var reg=/^[a-zA-Z][a-zA-Z0-9_]{4,15}$/;
        if(!reg.test(user)){//把需要验证的变量丢进去
            //假的话
            userId.innerHTML="用户名不正确(需由字母开头，允许5-16字节，允许字母数字下划线)";
            return false;
        }
        return true;
    }

    /*密码验证*/
    function checkPwd(){
        var pwd=$("#password").val();//取到值
        var pwdId=divId("passwordError");//取到响应元素
        pwdId.innerHTML="";
        var reg=/^[a-zA-Z]\w{5,17}$/;
        if(reg.test(pwd)==false){
            pwdId.innerHTML="密码不能含有非法字符(以字母开头，长度在6~18之间，只能包含字母、数字和下划线)";
            return false;
        }
        return true;
    }

    /*检查重复密码*/
    function checkRepwd(){
        var repwd=$("#reps").val();//取到值
        var pwd=$("#password").val();//取到响应元素
        var repwdId=divId("repsError");
        repwdId.innerHTML="";
        if(pwd!=repwd){
            repwdId.innerHTML="两次输入的密码不一样";
            return false;
        }
        return true;
    }

    /*验证邮箱*/
    function checkEmail(){
        var email=$("#email").val();//取到值
        var emailTest=divId("emailError");//取到响应元素
        emailTest.innerHTML="";
        var reg=/^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;
        if(reg.test(email)==false){
            emailTest.innerHTML="Email格式不正确，例11@qq.com";
            return false;
        }
        return true;
    }

    /*验证手机号*/
    function checkMobile(){
        var mobile=$("#phone").val();//取到值
        var mobileId=divId("phoneError");//取到响应元素
        mobileId.innerHTML="";
        var regMobile=/^(13[0-9]|14[5|7]|15[0|1|2|3|4|5|6|7|8|9]|18[0|1|2|3|5|6|7|8|9])\d{8}$/;
        if(regMobile.test(mobile)===false){
            mobileId.innerHTML="手机号不对，请重新输入";
            return false;
        }
        mobileId.innerHTML="";
        return true;
    }





    function userRegist() {
        var reps = $("#reps").val();
        var userName = $("#userName").val();
        var password = $("#password").val();
        var phone = $("#phone").val();
        var email = $("#email").val();
        $.ajax({
            url:"/user/regist",
            dataType:"json",
            data:{userName:userName,password:password,phone:phone,email:email},
            success:function (data) {
                return data;
            }
        });
        toindex();

    }


    function toindex() {
        window.location.href="index.html";
    }
</script>
</body>



<!--[if IE 6]>
<script src="//letskillie6.googlecode.com/svn/trunk/2/zh_CN.js"></script>
<![endif]-->
</html>
